import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
import { jsx as _jsx } from "react/jsx-runtime";
import { FullscreenExitOutlined, FullscreenOutlined } from '@ant-design/icons';
import { useIntl } from '@ant-design/pro-provider';
import { isBrowser } from '@ant-design/pro-utils';
import { Tooltip } from 'antd-v4';
import React, { useEffect, useState } from 'react';

var FullScreenIcon = function FullScreenIcon() {
  var intl = useIntl();

  var _useState = useState(false),
      _useState2 = _slicedToArray(_useState, 2),
      fullscreen = _useState2[0],
      setFullscreen = _useState2[1];

  useEffect(function () {
    if (!isBrowser()) {
      return;
    }

    document.onfullscreenchange = function () {
      setFullscreen(!!document.fullscreenElement);
    };
  }, []);
  return fullscreen ? _jsx(Tooltip, {
    title: intl.getMessage('tableToolBar.exitFullScreen', '全屏'),
    children: _jsx(FullscreenExitOutlined, {})
  }) : _jsx(Tooltip, {
    title: intl.getMessage('tableToolBar.fullScreen', '全屏'),
    children: _jsx(FullscreenOutlined, {})
  });
};

export default /*#__PURE__*/React.memo(FullScreenIcon);